package reflection;

import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;

public class UseMethodDemo {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
	try {
		Class <?> c1 = Class.forName("reflection.Person02");
		try {
			Method m = c1.getMethod("sayPerson02Info");
			try {
				m.invoke(c1.newInstance());
			} catch (IllegalAccessException e) {
	
				e.printStackTrace();
			} catch (IllegalArgumentException e) {
				
				e.printStackTrace();
			} catch (InvocationTargetException e) {

				e.printStackTrace();
			} catch (InstantiationException e) {

				e.printStackTrace();
			}
		} catch (NoSuchMethodException e) {

			e.printStackTrace();
		} catch (SecurityException e) {

			e.printStackTrace();
		}
	} catch (ClassNotFoundException e) {

		e.printStackTrace();
	}

	}

}
